home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / diskutil / bpb37.arc / bpb37.doc next >
Encoding:
Text File  |  1992-06-16  |  7.0 KB  |  154 lines

  1. BPB-37.TOS by Domenico De Vitto <ddv@uk.ac.bton.unix> (only till 1/7/1995)
  2.  
  3. Well this the first bit o' program that I am going to fling into the
  4. big wide world, and I'm only doing it because I'm off ill and this is one
  5. (the one ?) bit of program that works 100% and cannot be improved 
  6. (I think ...) that I have ever wrote.
  7.   First it was written many years ago (1989-1990???), not based or idea
  8. copied from anything, it simply tells you all about the boot sector details
  9. of a drive and also gets the lower-screen-half from the TOS, in case you 
  10. need to compare the details.
  11.  
  12. MOST IMPORTANT: I love Lucy Jane Bruton, and dedicate this to her. (ahhh).
  13.  
  14. As you all thought that was a copyright notice and naturally skipped it, I
  15. needn't be embarresed further in the document so anwards & upways...
  16.  
  17. Running it ...
  18. It should have a 'TOS' extention because of its nature but I haven't seen
  19. any difference when it has a PRG or TTP extention so it can be changed.
  20.  It is meant to be run from the desktop so don't moan about it clearing
  21. you shell screen, anyway I think it looks nice.
  22.  
  23. Things it does...
  24. I was going to enter a huge piece of text on its workings but that is 
  25. really boring for all the non-programmers, and they can read the source.
  26.  
  27. This is what it does:
  28. If you're in medium-rez it changes down to low - perfectly legal this 
  29.  and it's clearer.
  30.  
  31. Drops the title on the top line.
  32.  
  33. Gets from the TOS the valid drive letters and displays them.
  34.  
  35. Gets a key from the keyboard & converts it to uppercase (if a letter!).
  36.  
  37. If the key is a valid drive letter (bit complex this check) it displays
  38.  the drive you selected (now in uppercase).
  39.  
  40. Reads in the bootsector from the right drive, even if the disc has just
  41.  been swapped.
  42.  
  43. If the read sector call returns non-zero - error - tell the user & skip 
  44.  the display of the boot sector info.
  45.  
  46. Otherwaise..
  47. Displays all the info it can about the boot-sector :
  48. Boot branch - 'system disks' & the like use this to load the operating
  49.   system, games (can) use it for loading quickly, as do virii.
  50.   - if this is 0 you cannie have a boot-sector virus on the disk.(theory?)
  51. Volume serial - used by the system to tell if you swapped disks, every disk
  52.  should have a random serial put here at format time for this purpose.
  53. Bytes per sector - $200 (512 decimal) on most disks - if its not the same
  54.  at the ACTUAL sector size system may(??) go mad as a sponge.
  55. Sectors per cluster - 'cluster' being the smallest number of sectors one
  56.  file can use on the disk, usually 2 (sectors).
  57. Reseerved sectors - always at least one as the boot sector counts as the 
  58.  first. Used by system-loaders & VERY BIG virii (gulp).
  59. File Allocation Tables (FATs) (number of) - FATs are used to keep track of
  60.  all the places on the disk where your files are etc. 'Cause the're so 
  61.  important there are this many (usually 2) copies updated at the same time.
  62. Max root dir entries - the largest number of files that you can have in
  63.  the root dir, usually 128 for floppies. Folders are files and can grow
  64.  in size if more file entries (=name,date modified,size in bytes etc)
  65.  are needed, but the root dir is a set size and therfore can only hold
  66.  a limited number of file entries.
  67. Sectors - the total number of sectorson the media including
  68.  reserved sectors, any hidden sectors, the FATs, the root dir and the
  69.  'data area' where your files & folders are stored.
  70. Media descripter - this is meant to describe the media type on PCs 
  71.  ie hard disk, 3.5" floppy etc, etc. should really be $F8, but the TOS
  72.  ignores it completely, so it is whatever your formatter sets it to be!
  73. Sectors per FAT - this is the size in sectors of EACH File Allocation
  74.  Table.
  75. Sectors per track - The number of sectors per track usually 9 or 10.
  76.  therefore TRACKS = (total sectors / sides on media) / sectors per track.
  77. Sides on media - for floppies 1 or 2 is valid, but hard disk controllers 
  78.  can pull a few tricks on the TOS and pretend there are more 'sides' 
  79.  - 64 is not unusual.
  80. Hidden sectors - this isn't very well documented anywhere, but I think
  81.  these are like 'extra reserved sectors' - comments anyone ?
  82. Calculated dir sector - worked out as :
  83.   reserved sectors + hidden sectors + (number of FATs * sectors per FAT)
  84.  this should be the first root dir sector.
  85.  I have recently used this info to write zeros to this sector and then ran
  86.  a file system checker (FCHK.TOS) to clean up the mess and leave me with a
  87.  completely clean hard disk partition !  (I wanted this as well!)
  88.  
  89. Information from the TOS
  90. This info I added to BPB-37 'cause it gives :
  91. Total clusters - should be something like (you may need to +/- 1 ? to this)
  92.  (total sectors - system sectors) / sectors per cluster
  93.  where system sectors is
  94.  calculated dir sector +
  95.   ( number of root dir entries * 32 / bytes per sector )
  96. Free clusters - the number of free clusters.
  97. Sectors per cluster - a less trustable source of this value than direct
  98.  from the boot sector, but what the TOS THINKS it is.
  99. Bytes per sector - likewise.
  100. 'Therefore free space' - free space in bytes (using the TOS values) as 
  101.    free clusters * sectors per cluster * bytes per sector 
  102.  divided by 1024 to get Kb.
  103.  
  104. Phew ! After you have read all the info it waits for a keypress (any).
  105.  
  106. If it was originally in medium rez it changes back and resets the colours
  107. so the system as it was - all legal calls !!!
  108.  
  109. Then...... it quits back to the calling desktop/shell etc.
  110.  
  111. Phew ! - all the equations & algos by the way are from the top of my head
  112. so don't trust me, check them yourself.
  113.  
  114. Notes.
  115. It gives you a lot of info, it fits in 2K (the original version was less 
  116. than 1Kb). It was written in assembly using Genst 1.25 (Thanks ST-Format !) 
  117. and the book 'The conise atari st 68000 programmer's reference guide'
  118. by Kathrine Peel (one really good book).
  119.  
  120. Copyrights & the disclaimers
  121. I wrote this software but you use it at your own risk, so don't get me in
  122. court is it causes earthquakes in El-Salvador or something.
  123. You may copy, distribute, BUT NOT SELL IT, modest distribution costs may be
  124. charged - but remember it's FREE.
  125.  
  126. If you do pass it on you should pass this doc file on with it so that it's
  127. ease of use is not lost down the generations.
  128.  
  129. Please feel free to use the routines in the source code in your own
  130. programs but bear in mind that once the program all fitted in less than 2K
  131. I paid no attention to speed, effeciency or 'properness' of the code, but
  132. I think that it all works properly !
  133.  
  134. This doc file is toooooo huge for the program now so just remember this:
  135. If you believe this software to be worth paying for, then pay me 10%
  136. of what it's worth - thats how much I'd get if I marketed it.
  137. Course you could simply send me any tips/advice/good jokes and then we
  138. can get on with the job of writing better software for the ST range.
  139.  
  140. Any problems/enquiries etc with the program please E-mail me at :
  141.    ddv@uk.ac.bton.unix   or surface mail me at :
  142.  
  143.    1 Green Lane,
  144.    Devizes,
  145.    Wiltshire,
  146.    England.
  147.    SN10 5BL
  148.  
  149. Yours,
  150.  
  151. Domenico De Vitto.
  152.  
  153.  
  154.